﻿function MB_GetObjectTop(obj) 
{ 
if(obj.offsetParent == document.body) 
    return obj.offsetTop; 
else 
    return obj.offsetTop + MB_GetObjectTop(obj.offsetParent); 
} 

function MB_GetObjectLeft(obj) 
{ 
if(obj.offsetParent == document.body) 
    return obj.offsetLeft; 
else 
    return obj.offsetLeft + MB_GetObjectLeft(obj.offsetParent); 
} 

function activexFileForm()
{
val = document.form;
for(i=0 ; i<val.elements.length ; i++){ 
if(val.elements[i].type == 'file') { 
    el = val.elements[i];
    
    x = MB_GetObjectLeft(el);
    y = MB_GetObjectTop(el);
    wd = el.style.width;
    he = el.style.height;
    
    wds = Number(wd.substr(0,wd.length-2));

    if(!document.getElementById("layerId_"+el.name)) { 
    var layer = document.createElement("div"); 
    layer.setAttribute("id", "layerId_"+el.name); 
    layer.style.position = "absolute"; 
    layer.style.backgroundColor = "#d6d3ce";
    layer.style.left = x + wds - 96; 
    layer.style.top = y; 
    layer.style.width = 96;
    layer.style.height = he;
    layer.innerHTML = "<div id='benId_"+el.name+"' align=center style='width:96;font-size: 9pt;padding-top:2px;cursor:hand;' onclick=AttachFilesForm('"+el.name+"')>찾아보기...</div>";
    document.body.appendChild(layer); 
    }
    else {
    var layer = document.getElementById("layerId_"+el.name);	
    layer.style.left = x + wds - 96; 
    layer.style.top = y; 
    layer.style.width = 96;
    layer.style.height = he;
    }
 
} 
} 
}